package Grafica;

import java.util.Vector;

import javax.swing.Icon;
import javax.swing.ImageIcon;

public class AnimatedSprite {
	protected Vector<Icon> accion;
	protected boolean temporal;
	protected int indice = 0;
	
	public AnimatedSprite()
	{
		this.accion = new Vector<Icon>();
		this.temporal = false;
	}
	
	public void AgregarImagen( ImageIcon ii )
	{
		this.accion.add(ii);
	}
	
	public Icon obtenerImagen( int i )
	{
		return this.accion.get(i);
	}
	
	public Icon obtenerImagen()
	{
		Icon c = this.obtenerImagen(this.indice);
		if (this.indice < this.accion.size()-1)
		{
			this.indice++;
		} else
		{
			this.indice = 0;			
		}
		return c;
	}
	
	public int obtenerLongitud()
	{
		return this.accion.size();
	}
	
	public void setearTemporal ( boolean b )
	{
		this.temporal = b;
	}
	
	public boolean esTemporal( )
	{
		return this.temporal;
	}
}
